<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>

    </style>
</head>

<body>
    <div id="app">
        <input type="text" v-model="uname" @keyup.delete='clearText()'>
        <input type="text" v-model="pwd">
    </div>
    <script src="./node_modules/vue/dist/vue.js"></script>
    <script>
        // 相当于viewmodel层
        let vm = new Vue({
            el: '#app',
            // model层
            data() {
                return {
                    uname: '',
                    pwd: ''
                }
            },
            // 定义方法的节点
            methods: {
                clearText() {
                    this.uname = '';
                }
            }
        });
    </script>
</body>

</html>